package com.panshi.vo.search;

import lombok.Data;

import java.io.Serializable;

@Data
public class Paging<T> implements Serializable {
    private int total;//总数

    private T rows;

    private int pageSize = 10;//页大小

    private int currentPage = 1;//当前所在页

    private int startNum;//从几开始

    private int sum;//总页数

    public int getStartNum(){
        if(currentPage == 0) {
            return 0;
        }else {
            return (currentPage - 1) * pageSize;
        }
    }

    public int getSum(){
        if(total / pageSize == 0){
            return total / pageSize;
        }else {
            return (total / pageSize) + 1;
        }
    }
}
